package mjc.egg;
import mjc.tds.*;
import mjc.type.*;
import mjc.gc.*;
import mjc.compiler.*;
import java.util.*;
import mg.egg.eggc.compiler.libjava.lex.*;
import mg.egg.eggc.compiler.libjava.*;
import mg.egg.eggc.compiler.libjava.problem.IProblem;
import java.util.Vector;
import java.util.List;
import java.util.ArrayList;
public class S_ERX_MJAVA implements IDstNode {
LEX_MJAVA scanner;
  S_ERX_MJAVA() {
    }
  S_ERX_MJAVA(LEX_MJAVA scanner) {
    this.scanner = scanner;
    offset = 0;
    length = 0;
    this.att_scanner = scanner;
    }
int [] sync= new int[0];
  String att_code;
  DTYPE att_type;
  TDS att_tds;
  TAM att_cpu;
  LEX_MJAVA att_scanner;
  LinkedList<TDS> att_tdsi;
  private void regle42() throws Exception {
 offset = scanner.getOffset(0);

    //declaration
    //appel
      action_code28_42();
      action_type_42();
   length = 0; offset = scanner.getPreviousOffset();  }
  private void regle41() throws Exception {
 offset = scanner.getOffset(0);

    //declaration
    S_OPREL_MJAVA x_2 = new S_OPREL_MJAVA(scanner) ;
    S_ES_MJAVA x_3 = new S_ES_MJAVA(scanner) ;
    //appel
      action_auto_inh_41(x_2, x_3);
    x_2.analyser() ;
      addChild(x_2);
    x_3.analyser() ;
      addChild(x_3);
      action_code27_41(x_2, x_3);
      action_type_41(x_2, x_3);
     length =x_3.getOffset() + x_3.getLength()  -offset;
  }
private void action_code27_41(S_OPREL_MJAVA x_2, S_ES_MJAVA x_3) throws Exception {
try {
// instructions
this.att_code=x_3.att_code+this.att_cpu.genOPREL(x_2.att_operateur, x_3.att_type.getNom());
}catch(RuntimeException e) {		//e.printStackTrace();
	}
  }
private void action_type_42() throws Exception {
try {
// instructions
this.att_type= new DTYPE("null", 0);
}catch(RuntimeException e) {		//e.printStackTrace();
	}
  }
private void action_code28_42() throws Exception {
try {
// instructions
this.att_code=" ";
}catch(RuntimeException e) {		//e.printStackTrace();
	}
  }
private void action_type_41(S_OPREL_MJAVA x_2, S_ES_MJAVA x_3) throws Exception {
try {
// instructions
if (!(x_3.att_type.compareTo( new DTYPE("int", 1)))){
att_scanner._interrompre(IProblem.Semantic, att_scanner.getBeginLine(), IMJAVAMessages.id_T_03, MJAVAMessages.T_03,new Object[]{""+x_3.att_type.getNom()});

}
else {
this.att_type=x_3.att_type;
}
}catch(RuntimeException e) {		//e.printStackTrace();
	}
  }
private void action_auto_inh_41(S_OPREL_MJAVA x_2, S_ES_MJAVA x_3) throws Exception {
try {
// instructions
x_3.att_tds=this.att_tds;
x_3.att_tdsi=this.att_tdsi;
x_3.att_cpu=this.att_cpu;
}catch(RuntimeException e) {		//e.printStackTrace();
	}
  }
  public void analyser () throws Exception {
    scanner.lit ( 1 ) ;
    switch ( scanner.fenetre[0].code ) {
      case LEX_MJAVA.token_inf : // 45471
        regle41 () ;
      break ;
      case LEX_MJAVA.token_infeg : // 45472
        regle41 () ;
      break ;
      case LEX_MJAVA.token_sup : // 45473
        regle41 () ;
      break ;
      case LEX_MJAVA.token_supeg : // 45474
        regle41 () ;
      break ;
      case LEX_MJAVA.token_eg : // 45475
        regle41 () ;
      break ;
      case LEX_MJAVA.token_neg : // 45476
        regle41 () ;
      break ;
      case LEX_MJAVA.token_affect : // 45455
        regle42 () ;
      break ;
      case LEX_MJAVA.token_virg : // 45452
        regle42 () ;
      break ;
      case LEX_MJAVA.token_pv : // 45453
        regle42 () ;
      break ;
      case LEX_MJAVA.token_parf : // 45447
        regle42 () ;
      break ;
      default :
               scanner._interrompre(IProblem.Syntax, scanner.getBeginLine(), IMJAVAMessages.id_MJAVA_unexpected_token,MJAVAMessages.MJAVA_unexpected_token,new String[]{scanner.fenetre[0].getNom()});
    }
  }
    private IDstNode parent;
    public void setParent( IDstNode p){parent = p;}
    public IDstNode getParent(){return parent;}
    private List<IDstNode> children = null ;
    public void addChild(IDstNode node){
      if (children == null) {
         children = new ArrayList<IDstNode>() ;}
      children.add(node);
      node.setParent(this);
    }
    public List<IDstNode> getChildren(){return children;}
    public boolean isLeaf(){return children == null;}
    public void accept(IDstVisitor visitor) {
      boolean visitChildren = visitor.visit(this);
      if (visitChildren && children != null){
        for(IDstNode node : children){
          node.accept(visitor);
        }
    }
    visitor.endVisit(this);
  }
  private int offset;
  private int length;
  public int getOffset(){return offset;}
  public void setOffset(int o){offset = o;}
  public int getLength(){return length;}
  public void setLength(int l){length = l;}
  private boolean malformed = false;
  public void setMalformed(){malformed = true;}
  public boolean isMalformed(){return malformed;}
  }
